<xsl:variable name="cijfer">m1</xsl:variable>
<xsl:variable name="periode">periode 1</xsl:variable>

<xsl:template match='/'>
\documentclass{article}
\usepackage[dutch]{babel}
\usepackage[latin1]{inputenc}
\usepackage{array}
\usepackage{a4wide}
\usepackage{color}
\usepackage{colortbl}
\pagestyle{empty}
\renewcommand{\arraystretch}{1.1}
\setlength\textheight{28cm}
\setlength\textwidth{19cm}
\addtolength\voffset{-2.5cm}
\addtolength\hoffset{-2.2cm}
\setlength{\tabcolsep}{0.1cm}
\begin{document}
\noindent
\subsection*{Sint-Ritacollege <xsl:value-of select='//rapport[1]/@jaar' />-<xsl:value-of select='//rapport[1]/@jaar + 1' /> \hfill Overzicht commentaar <xsl:value-of select='//rapport[1]/leerling/klas' /> \hfill Maandrapport <xsl:value-of select='$periode' />}
\hrule
\mbox{}
\\[0.5cm]
	<xsl:apply-templates select='//rapport'  />
\end{document}	 
</xsl:template>

<xsl:template match='rapport'>
  <xsl:if test='commentaar//klasleraar[@periode=$cijfer]'>
    \begin{tabular}{|p{1cm}p{17.5cm}|}
    \hline
    \multicolumn{2}{|c|}{\rowcolor[gray]{0.8}\color{black}<xsl:value-of select="leerling/voornaam" />&#32;<xsl:value-of select="leerling/achternaam" />}\\
    \hline
    \hline
    <xsl:for-each select="commentaar/*"><xsl:call-template name="commentaar" /></xsl:for-each>
    \hline
    \end{tabular}
    \\[0.2cm]
  </xsl:if>
</xsl:template> 

<xsl:template name="commentaar">
<xsl:if test="klasleraar/@periode=$cijfer">
{\bf <xsl:value-of select="name()" /> } 
<xsl:apply-templates select="klasleraar[@periode=$cijfer]" /> 
</xsl:if>
</xsl:template>

<xsl:template match="klasleraar">
  &amp; <xsl:value-of select="." /> \\
</xsl:template>